/**
 * @file socket_worker.h
 * @author HaoyuWang (136046355@qq.com)
 * @brief 网络工作线程
 * @version 0.1
 * @date 2025-01-25
 * 
 * @copyright Copyright (c) 2025
 * 
 */

#ifndef __SOCKET_WORKER_H__
#define __SOCKET_WORKER_H__

#include <sys/epoll.h>
#include <memory>

#include "conn.h"

class SocketWorker
{
private:
    void OnEvent(epoll_event ev);
    void OnAccept(std::shared_ptr<Conn> conn);
    void OnRW(std::shared_ptr<Conn> conn, bool r, bool w);

public:
    SocketWorker(/* args */);
    ~SocketWorker();

    void Init();
    void operator()();

    void AddEvent(int fd);
    void RemoveEvent(int fd);
    void ModifyEvent(int fd, bool epoll_out);

private:
    int epfd_;

};


#endif  // __SOCKET_WORKER_H__